package dry.example.runner;

import java.lang.reflect.Method;
import java.lang.reflect.Modifier;

/**
 * @author zc
 */
public class MethodTraversal {

    public static void main(String[] args) {
        Class<?> clazz = DemoUser.class;
        Method[] methods = clazz.getDeclaredMethods();
        for (Method method : methods) {
            System.out.println("修饰符:" + Modifier.toString(method.getModifiers()));
            System.out.println("方法名称:" + method.getName());
            System.out.println("参数个数:" + method.getParameterCount());
            System.out.println("返回类型:" + method.getReturnType());
            Class<?>[] parameterTypes = method.getParameterTypes();
            System.out.println("参数类型 start");
            for (Class<?> parameterType : parameterTypes) {
                System.out.println(parameterType.getName());
            }
            System.out.println("参数类型 end");
        }
    }

}
